from ruamel.yaml import YAML

def _flat_map(config, target = None, prefix = ""):

    if target is None:
        target = list()
    for i, j in config.items():
        if type(j) is dict:
            _flat_map(j, target, prefix+i+'.')
        else:
            target.append((prefix+i,j))
    return target

if __name__ == '__main__':

    yaml = YAML(typ="safe")

    with open("sample.yaml", 'r') as f:
        config = yaml.load(f)

    result = _flat_map(config)
    print(result)